package com.zzs.client.controller;

import com.zzs.client.pojo.query.ProblemCodeQuery;
import com.zzs.client.pojo.vo.ProblemCodeVO;
import com.zzs.client.service.ProblemCodeService;
import com.zzs.common.core.response.Result;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zzs
 * @date 2025/03/27
 */
@RestController
@RequestMapping("/client/codes")
public class ProblemCodeController {
    @Autowired
    private ProblemCodeService problemCodeService;

    @GetMapping
    public Result<ProblemCodeVO> getProblemCode(@Valid ProblemCodeQuery problemCodeQuery) {
        ProblemCodeVO problemCodeVO = problemCodeService.getProblemCode(problemCodeQuery.getProblemId(), problemCodeQuery.getLanguage());
        return Result.success(problemCodeVO);
    }
}
